{include 'admin/layout/header_list'}
<link rel="stylesheet" href="__ADMIN_STATIC__/css/addContent.css?random={extendSetting('random')}">
<div class="addcontent">
    <form class="ajaxForm" method="post" >
        <input type="hidden" name="_method" value="put" >
        <input type="hidden" name="id" value="{if isset($rowData['id'])}{$rowData['id']}{/if}" >
        <table class="table">
            <tr>
                <td class="tl">
                    <span>上级分类</span>
                </td>
                <td class="categoryBox">
                    <select name="pid" class="long" >
                        <option value="">请选择</option>
                        {YiFang:categoryHtml dataFields="pid" dataType="<request.dataType>"  dataId="<request.dataId>"  selectId="<rowData.pid>" /}
                    </select>
                    <i class="tips iconfont icon-yiwen" title="如果不选择，则为顶级分类"></i>
                </td>
            </tr>
            <tr>
                <td class="tl">
                    <span><strong>* </strong>名称</span>
                </td>
                <td>
                    <input class="long" name="name" type="text" value="{if isset($rowData['name'])}{$rowData['name']}{/if}" >
                </td>
            </tr>
            <tr>
                <td class="tl">
                    <span><strong>* </strong>分类目录[英文名]</span>
                </td>
                <td>
                    <input class="long" name="catDir" type="text" value="{if isset($rowData['catDir'])}{$rowData['catDir']}{/if}" >
                    <button class="btn2" onclick="ckDir()" >目录检测</button>
                    <i class="tips iconfont icon-yiwen" title="限英文、数字、中划线、下划线、斜线，该分类相关的html文件将保存在此目录"></i>
                </td>
            </tr>
            <!--<tr >-->
                <!--<td class="tl">-->
                    <!--<span>级别</span>-->
                <!--</td>-->
                <!--<td>-->
                    <!--<input type="text" name="level" value="{if isset($rowData['level'])}{$rowData['level']}{/if}">-->
                    <!--<i class="tips1 iconfont icon-yiwen" title="0 - 不在首页显示 1 - 正常显示 2 - 首页和上级分类并列显示"></i>-->
                <!--</td>-->
            <!--</tr>-->
            <!--<tr >-->
                <!--<td>-->
                    <!--<span>字段</span>-->
                <!--</td>-->
                <!--<td>-->
                    <!--<input type="text" name="fieldIndex" value="{if isset($rowData['fieldIndex'])}{$rowData['fieldIndex']}{/if}">-->
                <!--</td>-->
            <!--</tr>-->
            <!--<tr >-->
                <!--<td class="tl">-->
                    <!--<span>缩略图</span>-->
                <!--</td>-->
                <!--<td class="webUploadBox" >-->
                    <!--<input class="rendercls long" type="text" id="image" name="thumbnail" value="{if isset($rowData['thumbnail'])}{$rowData['thumbnail']}{/if}" >-->
                    <!--<div class="webUploadFilePicker upload">[上传]</div>-->
                    <!--<div class="upload" id="clear">[删除]</div>-->
                <!--</td>-->
            <!--</tr>-->
            <tr>
                <td class="tl">
                    <span>列表模板</span>
                </td>
                <td>
                    <select name="template_list" >
                        <option value="">默认模板</option>
                        {if isset($templateCategory['global']['list']) && $templateCategory['global']['list']}
                        {foreach $templateCategory['global']['list'] $key $val}
                        <option {if (isset($rowData['template_list']) && $rowData['template_list']==$key) }selected{/if} value="{$key}">{$val}</option>
                        {/foreach}
                        {/if}

                        {if isset($templateCategory['module'][$rowData['dataId']]['list']) && $templateCategory['module'][$rowData['dataId']]['list']}
                        {foreach $templateCategory['module'][$rowData['dataId']]['list'] $key $val}
                        <option {if (isset($rowData['template_list']) && $rowData['template_list']==$key) }selected{/if} value="{$key}">{$val}</option>
                        {/foreach}
                        {/if}

                        {if isset($templateCategory['category'][$rowData['id']]['list']) && $templateCategory['category'][$rowData['id']]['list']}
                        {foreach $templateCategory['category'][$rowData['id']]['list'] $key $val}
                        <option {if (isset($rowData['template_list']) && $rowData['template_list']==$key) }selected{/if} value="{$key}">{$val}</option>
                        {/foreach}
                        {/if}
                    </select>
                </td>
            </tr>
            <tr>
                <td class="tl">
                    <span>内容模板</span>
                </td>
                <td>
                    <select name="template_content" >
                        <option value="">默认模板</option>
                        {if isset($templateCategory['global']['detail']) && $templateCategory['global']['detail']}
                        {foreach $templateCategory['global']['detail'] $key $val}
                        <option {if (isset($rowData['template_content']) && $rowData['template_content']==$key) }selected{/if} value="{$key}">{$val}</option>
                        {/foreach}
                        {/if}

                        {if isset($templateCategory['module'][$rowData['dataId']]['detail']) && $templateCategory['module'][$rowData['dataId']]['detail']}
                        {foreach $templateCategory['module'][$rowData['dataId']]['detail'] $key $val}
                        <option {if (isset($rowData['template_content']) && $rowData['template_content']==$key) }selected{/if} value="{$key}">{$val}</option>
                        {/foreach}
                        {/if}

                        {if isset($templateCategory['category'][$rowData['id']]['detail']) && $templateCategory['category'][$rowData['id']]['detail']}
                        {foreach $templateCategory['category'][$rowData['id']]['detail'] $key $val}
                        <option {if (isset($rowData['template_content']) && $rowData['template_content']==$key) }selected{/if} value="{$key}">{$val}</option>
                        {/foreach}
                        {/if}
                    </select>
                </td>
            </tr>
            <tr >
                <td class="tl">
                    <span>排序</span>
                </td>
                <td>
                    <input type="text" name="sort" value="{if isset($rowData['sort'])}{$rowData['sort']}{/if}">
                </td>
            </tr>
            <tr >
                <td class="tl">
                    <span>Title(SEO标题)</span>
                </td>
                <td>
                    <input type="text" name="seo_title" value="{if isset($rowData['seo_title'])}{$rowData['seo_title']}{/if}">
                </td>
            </tr>
            <tr >
                <td class="tl">
                    <span>Meta Keywords<br />(网页关键词)</span>
                </td>
                <td>
                    <input type="text" name="seo_keywords" value="{if isset($rowData['seo_keywords'])}{$rowData['seo_keywords']}{/if}">
                </td>
            </tr>
            <tr >
                <td class="tl">
                    <span>Meta Description<br />(网页描述)</span>
                </td>
                <td>
                    <input type="text" name="seo_description" value="{if isset($rowData['seo_description'])}{$rowData['seo_description']}{/if}">
                </td>
            </tr>
            <tr>
                <td class="tl">
                    <span><strong></strong>状态</span>
                </td>
                <td>
                    <p class="article-status">
                        <input name="disabled" type="radio" value="1" {if isset($rowData['disabled'])}{$rowData['disabled']=="1" ?"checked":""} {/if}  >开启
                        <input name="disabled" type="radio" value="0" {if isset($rowData['disabled'])}{$rowData['disabled']=="0" ?"checked":""} {/if}  >禁用
                    </p>
                </td>
            </tr>
        </table>
        <div class="yifang-button">
            <button class="btns submit ajaxBtn" type="button" data-submit-url="{YIFANG_ROUTE_PREFIX}/category" data-form=".ajaxForm" data-location-url="{YIFANG_ROUTE_PREFIX}/category?dataType={if isset($rowData['dataType'])}{$rowData['dataType']}{/if}&dataId={if isset($rowData['dataId'])}{$rowData['dataId']}{/if}" data-close="5" >保存并提交</button>
            <button class="btns cancel">取消并返回</button>
        </div>
    </form>
</div>
<script src="__ADMIN_STATIC__/js/addContent.js?random={extendSetting('random')}"></script>
<script>
    function ckDir(){
        var carDir=$('input[name="catDir"]').val();
        if(carDir){
            $.get('{YIFANG_ROUTE_PREFIX}/category/checkDir?dataType={$request["dataType"]}&dataId={$request["dataId"]}&catDir='+carDir+'&id={$rowData["id"]}',{},function(content){
                if(!content.success)
                {
                    alert(content.codeMsg);
                }else{
                    alert("目录名可以使用");
                }
            });
        }else{
            alert("请填写分类目录");
        }
    }
</script>
{include 'admin/layout/file_upload_script_auto'}
{include 'admin/layout/footer'}